package com.zxx.javapattern.chainOfResponsibility.demo4;


public class GoodsSaleEbo {
    public boolean sale(String user, String customer, SaleModel saleModel) {
        //如果全部在这里处理,则按如下顺序
        //1.权限检查
        //2.通用数据校验,(这个可能在表现层已经实现过了)
        //3.数据逻辑校验(eg: age)
        //4.真正的业务数据

        //现在通过功能链来做,这里主要负责构建功能链
        SaleSecurityCheck ssc = new SaleSecurityCheck();
        SaleDataCheck sdc = new SaleDataCheck();
        SaleLogicCheck slc = new SaleLogicCheck();
        SaleMgr sm = new SaleMgr();
        ssc.setSuccessor(sdc);
        sdc.setSuccessor(slc);
        slc.setSuccessor(sm);
        return ssc.sale(user,customer,saleModel);
    }

}
